package tech.brick.easysharer.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping("/health")
public class HealthController {

    /**
     * 健康检查接口
     * 用于被局域网内其他客户端发现
     */
    @GetMapping
    @ResponseBody
    public ResponseEntity<Map<String, Object>> health() {
        Map<String, Object> response = new HashMap<>();
        response.put("status", "UP");
        response.put("service", "EasySharer");
        response.put("timestamp", System.currentTimeMillis());
        response.put("message", "服务运行正常");
        
        log.debug("健康检查请求");
        return ResponseEntity.ok(response);
    }
} 